{
	template:`
	<a-page-header title="查看SQL">
		<template #extra>
			<m-back @click="back(false);">关闭</m-back>
		</template>
		<a-card :hoverable="true" :bodyStyle="{padding:'20px'}">
		    SQL操作：<a-tag color="processing">{{method}}</a-tag>
		    结果：<a-tag :color="decode(result,'Success','success','warning')">{{result}}</a-tag>
		    <a-divider orientation="left">SQL和参数</a-divider>
            Preparing: {{sql}}<br/>
            Parameters: {{params}}
            <a-divider v-if="formatSql" orientation="left">转换结果</a-divider>
            {{formatSql}}
		</a-card>
	</a-page-header>
	`,
	props: ['localeZh','param','parentVue'],
	data:function(){
		return {
			sql:"",
			params:"",
			method:"",
			result:"",
			formatSql:""
		};
	},
	mounted(){
		this.sql=this.param.sql;
		this.params=this.param.params;
		this.method=this.param.method;
		this.result=this.param.result;
		if(this.method!='BatchUpdate'){
		    this.formatSql=this.convertSql(this.sql,this.params);
		}
	},
	methods:{
	    convertSql:function(sql,params) {
	        params=params.split(", ");
            for (var i = 0; i < params.length; i++) {
                // 如果数据中带括号将使用其他逻辑
                tempStr = params[i].substring(0, params[i].lastIndexOf("("));
                // 获取括号中内容
                typeStr = params[i].substring(params[i].lastIndexOf("(") + 1, params[i].lastIndexOf(")"));
                // 如果为字符类型
                if (typeStr == "String" || typeStr == "Timestamp") {
                    sql = sql.replace("?", "'" + tempStr + "'");
                } else {
                    // 数值类型
                    sql = sql.replace("?", tempStr);
                }
            }
            return sql;
        }
	}
}